home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Miscellaneous / CopyPaste 3.3.4 / CopyPaste Tools Sourcecode / Short Date / Short Date.p < prev    next >
Encoding:
Text File  |  1997-06-06  |  1.5 KB  |  69 lines  |  [TEXT/CWIE]

  1. {•This sourcecode is an example for creating a FKey coderesource with•}
  2. {•Metrowerks Pascal. It is copyrighted by Peter Hoerster and released•}
  3. {•for free use in any Shareware or Freeware product as a way to thank all•}
  4. {•programmers who share code snippets. You may put this sources on any•}
  5. {•CD ROM or any Archive Server but you may not sell it. •}
  6.  
  7. {• For comments please write to <hoerster@muenster.de>•}
  8.  
  9.  
  10.  
  11. unit ShortDate;
  12.  
  13. interface
  14.  
  15.     uses
  16.         Types, OSUtils, GestaltEqu, Script, notification, Resources, Events,
  17.          PascalA4, QuickDraw, ToolUtils, Memory, LowMem, Scrap;
  18.  
  19.  
  20.  
  21. {$MAIN}
  22.                         
  23.     procedure main;        
  24.  
  25. implementation
  26.  
  27.     procedure dopaste;
  28.     const
  29.         pastecode=2422;
  30.     var 
  31.         qel: EvQelPtr;
  32.     begin
  33.             if ppostevent(3, pastecode, qel) = noerr then
  34.             qel^.evtqmodifiers := cmdkey;
  35.     end;
  36.  
  37.  
  38.     procedure main;
  39.         var
  40.             oldA4: LongInt;
  41.             myerr: oserr;
  42.             myclipsize, templongint: longint;
  43.             myclipHandle: handle;
  44.             infostring: str255;
  45.  
  46.     
  47.             
  48.     begin
  49.         oldA4 := SetCurrentA4;
  50.         GetDateTime(templongint);
  51.         IUDateString(templongint, shortdate, infostring);
  52.         myclipsize:=length(infostring);
  53.         mycliphandle := Tempnewhandle(myclipsize,myerr);
  54.         if myerr=noerr then 
  55.             begin
  56.                 Temphlock(mycliphandle,myerr);
  57.                 if myerr=noerr then 
  58.                     begin
  59.                         blockmove(@infostring[1], mycliphandle^, myclipsize);
  60.                         myerr := ZeroScrap;
  61.                         myerr := putscrap(myclipsize, 'TEXT', myclipHandle^);
  62.                         dopaste;
  63.                     end;
  64.                 Temphunlock(myCliphandle,myerr);
  65.             end;
  66.         TempDisposeHandle(myCliphandle,myerr);
  67.         oldA4 := SetA4(oldA4);
  68.     end;
  69. end.